package com.qf.web;

import com.alibaba.fastjson.JSON;
import com.qf.web.pojo.Student;
import com.qf.web.service.StudentService;
import com.qf.web.service.impl.StudentServiceImpl;
import com.qf.web.vo.BarVo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@WebServlet("/echarts1")
public class EchartsServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        BarVo barVo = new BarVo();
        StudentService studentService = new StudentServiceImpl();
         barVo = studentService.seclctSexList();







       //BarVo barVo = new BarVo();
        //List<String> sexList = new ArrayList<>();
        //
        //sexList.add("男");
        //sexList.add("女");
        //
        //ArrayList<Integer> sexNum = new ArrayList<>();
        //
        //sexNum.add(20);
        //sexNum.add(10);
        //
        //barVo.setSexList(sexList);
        //barVo.setSexCount(sexNum);


        //把响应结果转换成JSON形式
        String s = JSON.toJSONString(barVo);
        resp.getWriter().println(s);
    }
}
